<?php


namespace App\Http\Transformers\Order;


use App\Models\Order;
use League\Fractal\TransformerAbstract;

class GetOrderDetailTransformer extends TransformerAbstract
{
    public function transform(Order $order)
    {
        $data = $order->toArray();

        $address = $data['address'] ? \GuzzleHttp\json_decode($data['address'], true) : null;
        data_set($data, 'address', $address);

        return $data;
    }
}
